//
//  MineViewController.m
//  CoachsBook
//
//  Created by MaBookPro on 2022/8/8.
//

#import "MineViewController.h"
#import "MineHeadView.h"
#import "MineBottomView.h"
#import "CertificationViewController.h"
#import "ClassTypeTableViewController.h"
#import "TrainingViewController.h"
#import "ExamArrangementTableViewController.h"
#import "PracticePartnerViewController.h"
#import "RegistrationPointViewController.h"
#import "StudentReviewsViewController.h"
#import "InviteStudentsViewController.h"
#import "ClueRecycleBinViewController.h"
#import "OtherSettingsViewController.h"

@interface MineViewController ()<MineBottomViewDelegate>
{
    UIScrollView *_ScrollView;
    MineHeadView *_MineHeadView;
    MineBottomView *_MineBottomView;
    
}
@end

@implementation MineViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIImageView *headImg = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, APPwidth, 120)];
    headImg.backgroundColor = [UIColor whiteColor];
    headImg.image = [UIImage imageNamed:@"HeadImg"];
    headImg.layer.cornerRadius = 125/2;
    headImg.userInteractionEnabled = YES;
    [self.view addSubview:headImg];
    
    //隐藏头部view
    self.navigationController.navigationBar.hidden = YES;
    NavigationHeadView *navgationheadv = [[NavigationHeadView alloc]initWithFrame:CGRectMake(0, 0, APPwidth, SafeAreaTopHight)];
    navgationheadv.backgroundColor = [UIColor clearColor];
    navgationheadv.backbtn.hidden = YES;
    navgationheadv.titlelabel.text = @"教练宝典";
    [self.view addSubview:navgationheadv];

    
    _ScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, APPwidth, APPheight-kTabbarHeight)];
    _ScrollView.contentSize = CGSizeMake(APPwidth,APPheight*2);
//    _ScrollView.backgroundColor = rgba(244, 247, 252, 1);
    _ScrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
    _ScrollView.bounces = true; // 表明当前滑动是否有反弹效果
    _ScrollView.pagingEnabled = NO; // 分页效果
    _ScrollView.showsVerticalScrollIndicator = NO;
    _ScrollView.scrollEnabled = true; // 使当前能够滑动和不能滑动
    [self.view addSubview:_ScrollView];

    
    
    _MineHeadView = [[MineHeadView alloc]initWithFrame:CGRectMake(0, 40, APPwidth, 115+(APPwidth-30)/328*89)];
    [_ScrollView addSubview:_MineHeadView];
    [_MineHeadView.PleaseLoginBtn addTarget: self action:@selector(PleaseLoginBtnClick) forControlEvents:UIControlEventTouchUpInside];
    
    _MineBottomView = [[MineBottomView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_MineHeadView.frame), APPwidth, 526)];
    _MineBottomView.delegate = self;
    [_ScrollView addSubview:_MineBottomView];
    
    
    _ScrollView.contentSize = CGSizeMake(APPwidth,926);
}


#pragma mark - 服务事件处理
-(void)ServicesBtnSelectedDelegate:(NSInteger)tag
{
    switch (tag) {
        case 0:
        {
            CertificationViewController *vc = [[CertificationViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 100:
        {
            ClassTypeTableViewController *vc = [[ClassTypeTableViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 200:
        {
            TrainingViewController *vc = [[TrainingViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 300:
        {
            ExamArrangementTableViewController *vc = [[ExamArrangementTableViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 400:
        {
            PracticePartnerViewController *vc = [[PracticePartnerViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 500:
        {
            RegistrationPointViewController *vc = [[RegistrationPointViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 600:
        {
            StudentReviewsViewController *vc = [[StudentReviewsViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 700:
        {
            InviteStudentsViewController *vc = [[InviteStudentsViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 800:
        {
            ClueRecycleBinViewController *vc = [[ClueRecycleBinViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 900:
        {
            OtherSettingsViewController *vc = [[OtherSettingsViewController alloc]init];
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        default:
            break;
    }
}

#pragma mark -登录
-(void)PleaseLoginBtnClick
{
    
}

#pragma mark -视图即将出现
-(void)viewWillAppear:(BOOL)animated{
        
    ((TabbarController *)self.tabBarController).tabBarView.hidden = NO;
    
}


@end
